<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="header/h5header::h5header('评论','','')">
</head>

<body>
<!-- 正文 -->
<div class="Headline">
    <div class="indexHeadline">
        <div class="Headline-tReply">
            <a th:href="'/details/' + ${article}" class="Headline-tReplyA">
            	<i class="iconfont">&#xe602;</i>
            </a>
            <h3 class="Headline-tReplyH4">评论</h3>
            <a href="javascript:;" id="sendmsg" class="Headline-tReplyA2">发送</a>
        </div>
    </div>

    <!--写评论-->
    <div class="CommentMsg ReplyList">
        <div class="inputReply">
        	<input type="hidden" th:value="${article}" id="articleId">
            <div class="inputReply-text">
                <textarea  class="inputReply-textarea" name="retInputV" id="retInputV"  maxlength="100" placeholder="写评论..."></textarea>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
layui.use(['layer', 'setter', 'mynotice', 'admin', 'ax', 'util'], function () {
    var $ = layui.jquery;
    var layer = layui.layer;
    var setter = layui.setter;
    var mynotice = layui.mynotice;
    var admin = layui.admin;
    var $ax = layui.ax;
    var util = layui.util;
    
    var Comment = {
   		addComment: () => { // 评论
   			var ajax = new $ax('/zp/comment/add', 'post', function (res) {
   				window.location.href=document.referrer;
   			}, function (res) {
   				mynotice.error(res.msg);
   			});
   			var content = $('#retInputV').val();
   			if(content == ''){
 	        		mynotice.infoc('请输入评论内容！');
 	        		return false;
 	        	}
   			var data = {};
   			data['articleId'] = $('#articleId').val();
   			data['content'] = content;
   			ajax.setData(JSON.stringify(data));
   			ajax.start();
   		},
   		
    }
    
    // 新增评论
    $('#sendmsg').on('click', function(){
    	Comment.addComment();
    })
    
    
	
});
</script>

</body>
</html>